package com.mengxuegu.springboot.entities;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum UserResignStatus {
    YES("1", "是"),
    NO("0", "否"),
    OTHER("-1", "未知类型");
    @EnumValue
    private String code;
    @JsonValue
    private String desc;

    UserResignStatus(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @JsonCreator
    public static UserResignStatus find(String code) {
        UserResignStatus[] units = UserResignStatus.values();

        for (UserResignStatus unit : units) {
            if (unit.getCode().equals(code)) {
                return unit;
            }
        }
        return OTHER;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
